package com.cgc.venus.server.job.controller;

import com.cgc.venus.server.core.bean.response.VenusResponse;
import com.cgc.venus.server.core.bean.response.VenusResponseStatus;
import com.cgc.venus.server.core.exception.VenusException;
import com.cgc.venus.server.job.bean.HomeStatsInfo;
import com.cgc.venus.server.job.inter.HomeStatsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * Created by 业哥 on 2017/12/24
 */
@Api(value = "首页", description = "首页服务的api")
@RequestMapping("/home-admin")
@RestController
public class HomeStatsController {
    private static final Logger logger = LoggerFactory.getLogger(HomeStatsController.class);
    @Autowired
    private HomeStatsService homeStatsServiceImpl;
    @ApiOperation("统计首页信息")
    @RequestMapping(value = "/stats", method = RequestMethod.GET)
    @ResponseBody
    public VenusResponse<HomeStatsInfo> homeStats(@RequestParam(value="isSuperAdmin")Boolean isSuperAdmin,
                                           @RequestParam(value="namespace",required=false)String namespace) throws VenusException{
        HomeStatsInfo homeStatsInfo=homeStatsServiceImpl.stats(isSuperAdmin,namespace);
        VenusResponse<HomeStatsInfo> response=new VenusResponse<HomeStatsInfo>(VenusResponseStatus.OK,"",homeStatsInfo);
        return response;
    }
}